package com.zys.principles.demo3.emps.emp1;

/**
 * 基于接口传递依赖
 */
public class emp1 {
    public static void main(String[] args) {
        ChangHong changHong = new ChangHong();
        OpenAndClose openAndClose = new OpenAndClose();
        openAndClose.open(changHong);
    }
}

    class ChangHong implements ITV{
        @Override
        public void play() {
            System.out.println("长虹电视机打开了");
        }
    }

    interface IOpenAndClose{
        public void open(ITV tv);
    }

    interface ITV{
        public void play();
    }

    class OpenAndClose implements IOpenAndClose{
        @Override
        public void open(ITV tv) {
            tv.play();
        }
    }


